package com.hhs.storage.controller;


import com.hhs.storage.bean.UserFollowList;
import com.hhs.storage.service.UserFollowListService;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Map;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author hhs
 * @since 2023-03-10
 */
@RestController
@RequestMapping("/userFollowList")
public class UserFollowListController {
    @Resource
    private UserFollowListService userFollowListService;
    @RequestMapping("/add")
    public Map<String,Object> add(@RequestParam String followUserId,String groupId){
        return userFollowListService.add(followUserId,groupId);
    }
    @RequestMapping("/addAll")
    public Map<String,Object> addAll(@RequestParam String followUserIds,String groupId){
        return userFollowListService.addAll(followUserIds,groupId);
    }

    /**
     * 删除关注
     * @param id
     * @return
     */
    @RequestMapping("/removeById")
    public Map<String,Object> removeById(@RequestParam String id){
        return userFollowListService.removeById(id);
    }

    /**
     * 根据关注人id删除关注
     * @param followUserId
     * @return
     */
    @RequestMapping("/removeByFollowUserId")
    public Map<String,Object> removeByFollowUserId(@RequestParam String followUserId,String groupId){
        return userFollowListService.removeByFollowUserId(followUserId,groupId);
    }
    /**
     * 根据关注人id批量删除关注
     * @param followUserIds
     * @return
     */
    @RequestMapping("/removeAllByFollowUserId")
    public Map<String,Object> removeAllByFollowUserId(@RequestParam String followUserIds,String groupId){
        return userFollowListService.removeAllByFollowUserId(followUserIds,groupId);
    }
    /**
     * 查询所有关注人信息
     * @return
     */
    @RequestMapping("/getAll")
    public Map<String,Object> getAll(@RequestParam String groupId){
        return userFollowListService.getAll(groupId);
    }
}

